from BeautifulSoup import BeautifulSoup
import urllib2

url = urllib2.urlopen("http://www.jn.pt/paginainicial/")

doc = url.read()

soup = BeautifulSoup(''.join(doc))

list_h1 = soup.findAll('h1')
list_h2 = soup.findAll('h2')
list_h3 = soup.findAll('h3')
list_div = soup.findAll('div')
list_p = soup.findAll('p')
list_ul = soup.findAll('ul')
list_ol = soup.findAll('ol')

print "h1:", len(list_h1)
print "h2:", len(list_h2)
print "h3:", len(list_h3)
print "div:", len(list_div)
print "p:", len(list_p)
print "ul:", len(list_ul)
print "ol:", len(list_ol)
